package holdem.Rulegui;
import holdem.ListInt;

import java.util.Vector;


//treecode
//this is a Series of String which is exceped by datatree
//this is will lead to the
public class TreeCode extends Code{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2302915432537674962L;
	private Vector<Integer> path = new Vector<Integer>();
	
	public static void main(String[] s){
		Vector<Integer> in = new Vector<Integer>();
		in.add(0); in.add(2);
		Code tree = new TreeCode(in);
		System.out.println(tree.saveString());
		tree = Code.load(tree.saveString());
		System.out.println(tree.saveString());
		
	}
	
	public TreeCode(Vector<Integer> input){
		path = input;
	}


	@Override
	public ListInt parse(GeneticCode code, ListInt Wmemeory) {
		ListInt Rval = Wmemeory;
		for(int i =0; i < path.size(); i++){
			Rval = Rval.get(path.get(i));
		}
		return Rval;
	}
	@Override
	public String saveString() {
		String Rval = "";
		for(int i = 0; i < path.size(); i++){
			Rval += "T" + path.get(i);
		}
		return Rval;
	}
}
